﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="F400_Quan_ly_items.aspx.cs" Inherits="DanhMuc_F400_Quan_ly_items" %>
<%@Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor"%>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script src="../ckeditor/_Samples/ckeditor/ckeditor.js" type="text/javascript"></script>
        <script src="../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            function SelectAllCheckboxes(spanChk) {
                // Added as ASPX uses SPAN for checkbox
                var oItem = spanChk.children;
                var theBox = (spanChk.type == "checkbox") ? spanChk : spanChk.children.item[0];
                xState = theBox.checked;
                elm = theBox.form.elements;

                for (i = 0; i < elm.length; i++)
                    if (elm[i].type == "checkbox" && elm[i].id != theBox.id) {
                        if (elm[i].checked != xState)
                            elm[i].click();
                    }
            }
 
    </script>
        <script type="text/javascript">
            function pageLoad(sender, args) {
                if (args.get_isPartialLoad()) {
                }
            }
        </script>
        <style type="text/css">
            .btnFill
            {
                height: 23px;
                width: 80px;
            }
            .style1
            {
                width: 372px;
            }
            .style3
            {
                height: 17px;
            }
            .style4
            {
                width: 305px;
            }
            .style5
            {
                width: 755px;
            }
            .style6
            {
                width: 305px;
                height: 40%;
            }
            .style7
            {
                width: 557px;
                height: 40%;
            }
            .style8
            {
                width: 230px;
            }
        </style>
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div align="center">
                <asp:Label runat="server" Visible="False" ID="m_lbl_state">1</asp:Label>
                <table width="60%" cellspacing="0" border= "0" style="height: 61px">
                    <tr>
                        <td align="right">
                            <asp:ImageButton ID="ImageButton1" runat="server" OnClick="m_cmd_prev_Click" ImageUrl="~/Images/Previous-icon.png" Height="30px" />
                        </td>
                        <td align="center">
                            <asp:Label ID="m_lbl_bai" runat="server" Text="" CssClass="cssLabel"></asp:Label>
                        </td>
                        <td align="left">
                            <asp:ImageButton ID="ImageButton2" runat="server" 
                OnClick="m_cmd_next_Click" ImageUrl="~/Images/Next-icon.png" Height="30px" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <asp:ImageButton runat="server" OnClick="m_cmd_prev_cau_Click" 
                ImageUrl="~/Images/Previous-icon.png" Height="30px" ID="m_cmd_prev_cau" />
                        </td>
                        <td align="center" width="40%" style="color: #000000">
                            Câu thứ
                            <asp:Label ID="m_lbl_stt" runat="server" CssClass="cssLabel"></asp:Label>
                            &nbsp;/
                            <asp:Label ID="m_lbl_tong_so_cau" runat="server" CssClass="cssLabel"></asp:Label>
                        </td>
                        <td align="left">
                            <asp:ImageButton runat="server" OnClick="m_cmd_next_cau_Click" 
                ImageUrl="~/Images/Next-icon.png" Height="30px" ID="m_cmd_next_cau" />
                        </td>
                    </tr>
                </table>
                <table  width="100%" cellspacing="0" border= "0" style="height: 61px">
                    <tr>
                        <td>
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;</td>
                        <td align="center">
                            <asp:Button ID="m_cmd_them_moi0" runat="server" CssClass="cssButton" 
                                Height="23px" onclick="m_cmd_them_moi_Click" Text="Thêm Item" Width="97px" />
                            <asp:Button ID="m_cmd_sua_item0" runat="server" CssClass="cssButton" 
                                Height="23px" onclick="m_cmd_sua_item_Click" Text="Sửa Item" Width="97px" />
                            <asp:Button ID="m_cmd_xoa_item0" runat="server" CssClass="cssButton" 
                                Height="23px" onclick="m_cmd_xoa_item_Click" Text="Xóa item" Width="97px" />
                        </td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td align="justify">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:Label ID="Label12" runat="server" CssClass="cssLabel">1. Chọn Item</asp:Label>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <asp:ImageButton runat="server" ID="m_cmd_prev_item" 
                ImageUrl="~/Images/Button/sq_br_prev.png" onclick="m_cmd_prev_item_Click" Height="30px" />
                        </td>
                        <td align="center">
                            <CKEditor:CKEditorControl ID="m_p_noi_dung_cau" runat="server" ResizeEnabled="False" 
                    Width="650px" ClientIDMode="Static" Height="75px" Toolbar="Basic" ToolbarBasic="Bold|Italic|Underline|Strike|
Image|Flash|
TextColor|BGColor
Link|Unlink|Anchor"></CKEditor:CKEditorControl>
</td>
                        <td align="left">
                            <asp:ImageButton runat="server" ID="m_cmd_next_item" 
                ImageUrl="~/Images/Button/sq_br_next.png" onclick="m_cmd_next_item_Click" Height="30px" />
                        </td>
                    </tr>
                </table>
                <input type="hidden" id="textBox" runat="server" clientidmode="Static" />
                <table width="60%" cellspacing="0" border= "0" style="height: 61px; margin-left: 150px;">
                    <tr>
                        <td class="style6" align="left" width="50%">
                            &nbsp;</td>
                        <td class="style7" align="center">&nbsp;</td>
                    </tr>
                    <tr>
                        <td align="justify" class="style4" height="20" colspan="2">
                            <asp:Label ID="Label10" runat="server" CssClass="cssLabel">2. Nhập quá trình tư duy</asp:Label>
                        </td>
                    </tr>
                </table>
                <CKEditor:CKEditorControl ID="m_txt_qua_trinh_td" runat="server" ResizeEnabled="False" 
                    Width="650px" ClientIDMode="Static" Height="75px" Toolbar="Basic" ToolbarBasic="Bold|Italic|Underline|Strike|
Image|Flash|
TextColor|BGColor
Link|Unlink|Anchor"></CKEditor:CKEditorControl>
                <table width="60%" cellspacing="0" border= "0" style="height: 61px; margin-left: 150px;">
                    <tr>
                        <td align="left" class="style6" height="20">
                            &nbsp;</td>
                        <td class="style7">
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="left" class="style8" height="20">
                            <asp:Label ID="Label11" runat="server" CssClass="cssLabel">3. Nhập giải thích cho Item trên</asp:Label>
                        </td>
                        <td>
                            &nbsp;</td>
                    </tr>
                </table>
                <CKEditor:CKEditorControl ID="CKEditor1" runat="server" 
                    Width="650px" ClientIDMode="Static" Height="275px" Toolbar="Basic" ToolbarBasic="Bold|Italic|Underline|Strike|
Image|Flash|
TextColor|BGColor
Link|Unlink|Anchor" ResizeMaxHeight="800" ResizeMaxWidth="650" ResizeMinHeight="75" 
                    ResizeMinWidth="650"></CKEditor:CKEditorControl>
                <table width="60%" cellspacing="0" border= "0" style="height: 61px; margin-left: 150px;">
                    <tr>
                        <td class="style6" align="left" height="30">
                            <asp:FileUpload ID="m_fileUp_giai_thich" runat="server" />
                        </td>
                        <td class="style7">
                            <asp:Button ID="m_cmd_upload_giai_thich" runat="server" CssClass="cssButton" 
                                Height="23px" onclick="m_cmd_upload_giai_thich_Click" text="Upload" 
                                Width="97px" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left" class="style1" height="30">
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="left" class="style1" height="30">
                            <asp:Label ID="Label5" runat="server" CssClass="cssLabel">4. Viết tiêu đề Hệ thống kiến thức cho Items</asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="m_txt_tieu_de_htkt" runat="server" CssClass="" Width="150px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="style1" align="left" height="30"><asp:Label ID="Label3" runat="server" CssClass="cssLabel">5.Nhập đường dẫn cho hệ thống kiến thức</asp:Label></td>
                        <td><asp:TextBox runat="server" ID="m_txt_link_htkt" CssClass="" Width="150px"></asp:TextBox></td>
                    </tr>
                </table>
                <table width="80%">
                <tr>
                        <td align="center" class="style5">
                            &nbsp;</td>
                        <td align="center" class="style5">
                            <asp:Button ID="m_cmd_them_moi" runat="server" CssClass="cssButton" 
                                Height="23px" onclick="m_cmd_them_moi_Click" Text="Thêm Item" 
                                Width="97px" />
                            <asp:Button ID="m_cmd_sua_item" runat="server" CssClass="cssButton" 
                                Height="23px" onclick="m_cmd_sua_item_Click" Text="Sửa Item" Width="97px" />
                            <asp:Button ID="m_cmd_xoa_item" runat="server" CssClass="cssButton" 
                                Height="23px" onclick="m_cmd_xoa_item_Click" Text="Xóa item" Width="97px" />
                        </td>
                        <td align="center" class="style5">
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="left" class="style5" colspan="3">
                            <asp:Label ID="m_lbl_error_items" runat="server" CssClass="cssLabel" 
                                Font-Bold="True" ForeColor="Red"></asp:Label>
                        </td>
                    </tr>
            </table>
                <table width="80%" cellspacing="0" border= "0" 
                    style="height: 61px; margin-left: 8px;">
                    <tr>
                        <td colspan="3" align="left" bgcolor="Blue">
                            <asp:Label ID="Label8" runat="server" CssClass="cssLabel" Font-Bold="True" 
                                ForeColor="White">Danh sách Case study</asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="3">
                                <asp:GridView ID="m_grv_dm_case_study" runat="server" AutoGenerateColumns="False" 
                                    CellPadding="4" CssClass="cssGrid" DataKeyNames="ID" ForeColor="#333333" 
                                    Width="100%" onrowdeleting="m_grv_dm_case_study_RowDeleting" 
                                    onselectedindexchanging="m_grv_dm_case_study_SelectedIndexChanging" 
                                    onrowupdating="m_grv_dm_case_study_RowUpdating">
                                    <AlternatingRowStyle BackColor="White" />
                                    <Columns>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                 <asp:LinkButton ID = "lbt_update"  runat="server" CausesValidation="false"
                                                 CommandName="Update">
                                                 <img alt="Sửa" src="../Images/ArrowDown.GIF" />
                                                 </asp:LinkButton>
                                            </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" Width="5%" VerticalAlign="Middle"></ItemStyle>
                                        </asp:TemplateField>
                                        <asp:CommandField ItemStyle-HorizontalAlign="Center" 
                                            ButtonType="Image" SelectImageUrl="~/Images/ArrowUp.GIF" 
                                            ShowSelectButton="True" >
                                            <ItemStyle HorizontalAlign="Center" Width="5%" VerticalAlign="Middle" />
                                        </asp:CommandField>
                                        <asp:TemplateField HeaderText="STT" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <%# Container.DataItemIndex + 1 %>
                                            </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="BAI_TEST" HeaderText="Bài kiểm tra">
                                            <ItemStyle Width="25%" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="CAU_STT" HeaderText="Câu thứ">
                                            <ItemStyle Width="5%" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="CAU_CHUA_ITEMS" HeaderText="Câu" HtmlEncode="False" 
                                            HtmlEncodeFormatString="False">
                                            <ItemStyle HorizontalAlign="Left" Width="50%" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="NOI_DUNG" HeaderText="Item" 
                                            ItemStyle-HorizontalAlign="Center" HtmlEncode="False" 
                                            HtmlEncodeFormatString="False" Visible="False">
                                            <ItemStyle HorizontalAlign="Left" Width="30%" />
                                        </asp:BoundField>
                                        <asp:CommandField DeleteText="Xóa" ItemStyle-HorizontalAlign="Center" 
                                            ShowDeleteButton="True">
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:CommandField>
                                    </Columns>
                                    <EditRowStyle BackColor="#7C6F57" />
                                    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#810c15" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#E3EAEB" />
                                    <SelectedRowStyle BackColor="#C5BBAF" CssClass="cssSelectedRow" 
                                        Font-Bold="True" ForeColor="#333333" />
                                </asp:GridView>
                        </td>
                    </tr>
                    <tr>
                        <td class="style3" colspan="3"></td>
                    </tr>
                    <tr>
                        <td width="34%" align="right">
                            <asp:Label ID="Label6" runat="server" CssClass="cssLabel" Font-Bold="True" 
                                ForeColor="Red">Từ khóa tìm kiếm</asp:Label>
                        </td>
                        <td width="34%" align="center">
                            <asp:TextBox ID="m_txt_tim_kiem" runat="server" CssClass="" Width="150px"></asp:TextBox>
                        </td>
                        <td>
                            <asp:Button ID="m_cmd_tim_kiem" runat="server" CssClass="cssButton" 
                                Height="23px" onclick="m_cmd_tim_kiem_Click" Text="Tìm kiếm" 
                                Width="97px" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left" bgcolor="Blue" colspan="3">
                            <asp:Label ID="Label7" runat="server" CssClass="cssLabel" Font-Bold="True" 
                                ForeColor="White">Kết quả tìm kiếm</asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="3">
                                <asp:GridView ID="m_grv_tim_kiem" runat="server" AutoGenerateColumns="False" 
                                    CellPadding="4" CssClass="cssGrid" DataKeyNames="ID" ForeColor="#333333" 
                                    Width="100%" AllowPaging="True" PageSize="8" 
                                    onpageindexchanging="m_grv_tim_kiem_PageIndexChanging">
                                    <AlternatingRowStyle BackColor="White" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="STT" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <%# Container.DataItemIndex + 1 %>
                                            </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="BAI_TEST_TEN" HeaderText="Bài kiểm tra" />
                                        <asp:BoundField DataField="CAU_CHUA_ITEMS" HeaderText="Câu" HtmlEncode="False" 
                                            HtmlEncodeFormatString="False">
                                            <ItemStyle HorizontalAlign="Left" Width="45%" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="NOI_DUNG" HeaderText="Item" 
                                            ItemStyle-HorizontalAlign="Center" Visible="False">
                                            <ItemStyle HorizontalAlign="Left" />
                                        </asp:BoundField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                                <input type="checkbox" id="chkAll" onclick="javascript:SelectAllCheckboxes(this)" runat="server" />
                                            </HeaderTemplate>                 
                                          <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="chkItem" ToolTip='<%# Eval("ID") %>' />
                                          </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                          </asp:TemplateField>
                                    </Columns>
                                    <EditRowStyle BackColor="#7C6F57" />
                                    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#810c15" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#E3EAEB" />
                                    <SelectedRowStyle BackColor="#C5BBAF" CssClass="cssSelectedRow" 
                                        Font-Bold="True" ForeColor="#333333" />
                                </asp:GridView>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" align="center">
                            <asp:Button ID="m_cmd_chon" runat="server" CssClass="cssButton" Height="23px" 
                                onclick="m_cmd_chon_Click" Text="Lưu Case Study" Width="97px" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left" colspan="3">
                            <asp:Label ID="m_lbl_error" runat="server" CssClass="cssLabel" Font-Bold="True" 
                                ForeColor="Red"></asp:Label>
                        </td>
                    </tr>
                </table>
            
            </div>

            <asp:HiddenField ID="m_hdf_index" runat="server" />
            <asp:HiddenField ID="m_hdf_index_2" runat="server" />
            <asp:HiddenField ID="m_hdf_id_bai_test" runat="server" />
            <asp:HiddenField ID="m_hdf_id_cau" runat="server" />
            <asp:HiddenField ID="m_hdf_index_items" runat="server" />
            <asp:HiddenField ID="m_hdf_tong_so_items" runat="server" />
            <asp:HiddenField ID="m_hdf_cau_chua_item" runat="server" 
                ClientIDMode="Static" />
            <asp:HiddenField ID="m_hdf_noi_dung" runat="server" ClientIDMode="Static" />
            <asp:HiddenField ID="m_hdf_id_item" runat="server" ClientIDMode="Static" />
            <asp:HiddenField ID="m_hdf_id_dm_case_study" runat="server" 
                ClientIDMode="Static" />
            <asp:HiddenField ID="m_hdf_path" runat="server" ClientIDMode="Static" />
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="m_cmd_upload_giai_thich" />
        </Triggers>
    </asp:UpdatePanel>    
</asp:Content>

